// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-11-15

#ifndef __SVR_SHOWINFO_H_COMMON_SVR_BASE__
#define __SVR_SHOWINFO_H_COMMON_SVR_BASE__

#pragma once

#include <common/base/thread.h>
#include <common/svr_base/svr_msgwnd.h>

namespace JoyServer
{

class CJoyShowInfo;

enum InfoColor
{
    InfoColor_Default   = 0x000000,
    InfoColor_Error     = 0x0000FF,
    InfoColor_Special   = 0xFF0000,
    InfoColor_Note      = 0xFF00FF,
};

enum InfoLogLevel
{
    InfoLog_Critical = 0,
    InfoLog_Normal = 1,
    InfoLog_Debug = 2,
    InfoLog_Test = 3
};

// show informations to server window.
// asynchronize all operations.
class CJoyShowInfo
{
protected:
    friend class CJoyMsgWndShowInfoExec;

    CJoyMsgWnd  m_showInfoWnd;

    virtual void OnShowText(const CString& text, COLORREF c);
public:
    COLORREF m_defColor;
    int m_logLevel;
public:
    CJoyShowInfo();
    virtual ~CJoyShowInfo();

    virtual bool Create();
    virtual void Destroy();

    void AddText(PCSTR pszText, COLORREF c);
    void QueueTextV(PCSTR pszText, va_list args);
    void QueueText(PCSTR pszText, ...);
    void QueueTimeTextV(PCSTR pszText, va_list args);
    void QueueTimeText(PCSTR pszText, ...);
    void QueueColorTextV(COLORREF c, PCSTR pszText, va_list args);
    void QueueColorText(COLORREF c, PCSTR pszText, ...);
    void QueueTimeColorTextV(COLORREF c, PCSTR pszText, va_list args);
    void QueueTimeColorText(COLORREF c, PCSTR pszText, ...);

    void QueueLog(int nLevel, COLORREF c, PCSTR pszText, va_list args);
    void QueueLog(int nLevel, COLORREF c, PCSTR pszText, ...);
};

} // namespace JoyServer

#endif  // __SVR_SHOWINFO_H_COMMON_SVR_BASE__